import { tt } from "../../../ttapi_interface/ttapi.js";
import * as tt2 from "../../../ttapi_layer2/ttlayer2.js";
import { IFileEditor, IEditorUI, EditorBase, EditorInfo } from "../editorbase.js";
import * as EUI from "../../eui/EUI.js"


export class Text_EditorUI extends EditorBase {

    //editor 强制实现这五个方法
    async InitAsync(): Promise<{ ui: tt2.QUI_IElement, info: EditorInfo }> {
        let info = await tt2.QExt_IO.File_Info(this._filename);
        if (info.Length > 100 * 1024 * 1024)
            throw new Error("too much file:" + info.Length);


        let txt = await tt2.QExt_IO.File_Read(this._filename, true) as string;
        let label = EUI.EUI_Style.CreateBackWithText(txt, new tt.Color(1, 1, 1, 1));
        return { ui: label, info: { "text": "", canopen: false } };
    }
    async CleanAsync(): Promise<void> {
    }





}